<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="../js/jquery-3.5.0.min.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        $(function () {
            var citys=$("#city li");
            /*for (var i = 0; i <citys.length ; i++) {
                alert(citys[i].innerHTML)
            }*/
            /*citys.each(function (index,element) {
                if("天津"==element.innerHTML){
                    return true;
                }
                alert(index+":"+element.innerHTML)
            })*/
            /*$.each(citys,function (index,element) {
                if("天津"==element.innerHTML){
                    return true;
                }
                alert(index+":"+element.innerHTML)
            })*/
            for (li of citys){
                alert($(li).html())
            }
        })

    </script>
</head>
<body>
<ul id="city">
    <li>北京</li>
    <li>上海</li>
    <li>天津</li>
    <li>重庆</li>
</ul>
</body>
</html>
